package com.itheima.d2_collection_nesting;

import java.util.*;

/**
 * 目标：理解集合的嵌套。
 * 江苏省 = "南京市","扬州市","苏州市“,"无锡市","常州市"
 * 湖北省 = "武汉市","孝感市","十堰市","宜昌市","鄂州市"
 * 河北省 = "石家庄市","唐山市", "邢台市", "保定市", "张家口市"
 */
public class Test {
    public static void main(String[] args) {
        // 1、定义一个Map集合存储全部的省份信息，和其对应的城市信息。
        ArrayList<String> city = new ArrayList<>();
        Collections.addAll(city,"南京市","扬州市","苏州市","无锡市","常州市");

        ArrayList<String> city1 = new ArrayList<>();
        Collections.addAll(city1,"武汉市","孝感市","十堰市","宜昌市","鄂州市");

        ArrayList<String> city2 = new ArrayList<>();
        Collections.addAll(city2,"石家庄市","唐山市", "邢台市", "保定市", "张家口市");

        HashMap<String, List<String>> map = new HashMap<>();
        map.put("江苏省",city);
        map.put("湖北省",city1);
        map.put("河北省",city2);

        List<String> cities = map.get("江苏省");
        for (String c : cities) {
            System.out.println("c = " + c);
        }


    }
}
